package com.andfo.testframework;

import com.thoughtworks.selenium.SeleneseTestBase;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * User: andfo
 * Date: Jul 15, 2009
 */
public class RemotableSeleneseTestBase extends SeleneseTestBase {

    public void setUp(String url, String browserString, int port, String host) {
        if("localhost".equals(host) || "127.0.0.1".equals(host)) {

            SeleniumServerControl.getInstance().startSeleniumServer(port);
        }

        selenium = new DefaultSelenium(host, port, browserString, url);
        selenium.start();
        selenium.windowMaximize();
    }


    @Override
    public void tearDown() throws Exception {
        super.tearDown();
        SeleniumServerControl.getInstance().stopSeleniumServer();
    }

    public Selenium getSelenium() {
        return selenium;
    }

}
